﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Diagnostics;
using System.Reflection;
using System.Collections; 
using System.Web.UI;
using LigerMVC.Common;

namespace LigerMVC.Common.Extensions
{
    /// <summary>
    /// 扩展方法
    /// </summary>
    public static class ArrayExtension
    {
         

        /// <summary>
        /// 判断一个数值是否存在于集合
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="t"></param>
        /// <param name="enumerable"></param>
        /// <returns></returns>
        public static bool In<T>(this T t, IEnumerable<T> enumerable)
        {
            return enumerable.Contains(t);
        }

        /// <summary>
        /// 判断一个字符串是否存在于数组
        /// </summary>
        /// <param name="str"></param>
        /// <param name="args"></param>
        /// <returns></returns>
        public static bool In(this string str, params string[] args)
        {
            foreach (var arg in args)
            {
                if (arg.Equals(str))
                {
                    return true;
                }
            }
            return false;
        }
         

    }
}
